<?php
$response = array();
if (isset($_GET['callback'])) {

	$firstname = $_GET['firstname'];
	$lastname = $_GET['lastname'];
	$age = $_GET['age'];
	$email = $_GET['email'];
	$password = $_GET['password'];
	
	// include db connect class
    require_once __DIR__ . '/db_connect.php';
 
    // connecting to db
    $db = new DB_CONNECT();
	
	$result = mysql_query("INSERT INTO user_info(firstname, lastname, age, email, password) VALUES('$firstname', '$lastname', $age, '$email', '$password')");
	$json_result = "";
	
	if ($result == true) {
		// successfully inserted into database
		$response["success"] = 1;
		$response["message"] = "insert successfully.";
 
	} else {
		$response["success"] = 0;
		$response["message"] = "insert fault.";
	}

	//$arr = array("element1","element2",array("element31","element32"));
	
	echo $_GET['callback']."(".json_encode($response).");";
	
}

?>